package archer.framework.common.encrypt;

import com.avaje.ebean.config.EncryptKey;
import com.avaje.ebean.config.EncryptKeyManager;

/**
 * @author christ
 * @date 2015/7/20
 */
public class SystemEncryptKeyManager implements EncryptKeyManager {

    private String key;

    @Override
    public void initialise() {
        //empty here
    }

    @Override
    public EncryptKey getEncryptKey(String tableName, String columnName) {
        return new EncryptKey() {
            @Override
            public String getStringValue() {
                return getKey();
            }
        };
    }

    public String getKey() {
        return key;
    }

    public SystemEncryptKeyManager setKey(String key) {
        this.key = key;
        return this;
    }
}
